-- get_owner_data
--
local import = import
---@type behavior_ret
local bret = import('bt/bt_plugin/behavior3/behavior_ret')
---@type OWNER_VALUE_TYPE
local OWNER_VALUE_TYPE = import('bt/custom_node/enum_type_cfg/OWNER_VALUE_TYPE')
local M = {
    name = "get_owner_data",
    type = "Action",
    desc = "得到owner数据",
    args = {
        {
            name = 'name',
            type = 'enum',
            desc = '变量类型',
            options = OWNER_VALUE_TYPE
        },
    },
    output = { "数据" }
}

function M.run(node, env, value)
    local owner = env.owner
    local name = node.args.name
    if owner[name] ~= nil then
        return bret.SUCCESS, owner[name]
    end
    return bret.FAIL
end

return M
